package home.xyx.hw02727;

import java.util.Scanner;

////////////////////////////////////////////Vehicle///////////////////////////////////////
public class Vehicle {
	private String brand;
	private String color;
	private double speed = 0.0;

	// 有参构造函数
	public Vehicle(String brand, String color) {
		super();
		this.brand = brand;
		this.color = color;

	}

	public Vehicle() {

	}

	public String getBrand() {
		return brand;
	}

	// 通过构造函数赋值汽车brand，屏蔽branset方法达到不能修改汽车品牌
	/*
	 * public void setBrand(String brand) { this.brand = brand; }
	 */
	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public double getSpeed() {
		return speed;
	}

	public void setSpeed(double speed) {
		this.speed = speed;
	}

	public void run() {
		System.out.println("汽车跑得贼鸡儿快！！！");
		System.out.println("汽车的品牌是" + this.brand + "汽车的颜色是" + this.color + "速度为" + this.speed);

	}

	public static void alert() {
		System.out.println("!!!!!");
	}

}

///////////////////////// car//////////////////////
class Car extends Vehicle {
	// 子类中的特有属性
	private int loader;

	public Car(String brand, String color, int loader) {
		super(brand, color);
		this.loader = loader;
		// TODO Auto-generated constructor stub
	}

	public int getLoader() {
		return loader;
	}

	public void setLoader(int loader) {
		this.loader = loader;
	}

	public void run() {
		super.run();
		System.out.println("能搭载：" + this.loader + "人");

	}
}

//////////////////////////////// 【三】//////////////////////////////////////
//////////////////////////////// Shape----father/////////////////////////////////
abstract class Shape {
	private double area;
	private double per;
	private String color;

	// 有参构造方法
	public Shape(String color) {
		super();
		this.color = color;
	}

	public Shape() {

	}

	public void setArea(double area) {
		this.area = area;
	}

	public void setPer(double per) {
		this.per = per;
	}

	// 抽象类出面积周长
	public abstract double getArea();

	public abstract double getPer();

	public abstract void showAll();

	public String getColor() {
		return color;
	}

	public void printMe() {
		// 输出面积,周长
		System.out.println("面积为：" + this.getArea() + "周长为：" + this.getPer());
	}
}

////////////////////////////// Rectangle//////////////////////////
class Rectangle extends Shape {
	private int width;
	private int height;

	// 默认无参构造方法
	public Rectangle() {

	}

	// 有参构造方法为颜色，宽高赋值
	public Rectangle(String color, int width, int height) {
		super(color);
		this.width = width;
		this.height = height;
	}

	// 重写抽象类
	@Override
	public double getArea() {
		// TODO Auto-generated method stub
		return this.width * this.height;

	}

	@Override
	public double getPer() {
		// TODO Auto-generated method stub
		return (this.height + this.width) * 2;
	}

	@Override
	public void showAll() {
		super.printMe();
		// TODO Auto-generated method stub
		System.out.println("矩形长为：" + this.height);
		System.out.println("矩形宽为" + this.width);
		System.out.println("矩形的颜色为:" + super.getColor());

	}

}

//////////////////////////////// Circle//////////////////////////////////////
class Circle extends Shape {
	private int radius;
	private final double PI_NUM = 3.14;

	@Override
	public double getArea() {
		// TODO Auto-generated method stub
		// 计算圆的面积
		return PI_NUM * this.radius * this.radius;
	}

	@Override
	public double getPer() {
		// TODO Auto-generated method stub
		// 计算圆的周长
		return PI_NUM * (this.radius * 2);
	}

	@Override
	public void showAll() {
		// TODO Auto-generated method stub
		super.printMe();
		System.out.println("圆的周长为：" + this.radius);
		System.out.println("圆的颜色为:" + super.getColor());
	}

	public Circle() {
		super();
	}

	public Circle(String color, int radius) {
		super(color);
		this.radius = radius;
		// TODO Auto-generated constructor stub
	}

}

//////////////////////////////// 【四】//////////////////////////////////////
/////////////////////////// ColaEmployee ////////////////////////////////////
abstract class ColaEmployee {

	private String staName;
	private int staMonth;
	private final int month = 3;
	private final double money = 5000;

	public ColaEmployee(String staName, int staMonth) {
		super();
		this.staName = staName;
		this.staMonth = staMonth;
	}

	// 本月生日员工工资加100；
	public double getSalary(int month1) {
		if (month1 == this.month) {
			System.out.println("该员工本月过生日");
			return money + 100;
		}
		return money;
	}

	public String getStaName() {
		return staName;
	}

	public void setStaName(String staName) {
		this.staName = staName;
	}

	public int getStaMonth() {
		return staMonth;
	}

	public void setStaBirth(int staBirth) {
		this.staMonth = staBirth;
	}

	public double getMoney() {
		return money;
	}

	public abstract void printMoney();

}

/////////////////////// SalariedEmployee 固定工资///////////////////////////////
class SalariedEmployee extends ColaEmployee {

	private double salarMoney;

	public SalariedEmployee(String staName, int staMonth) {
		super(staName, staMonth);
		// TODO Auto-generated constructor stub
	}

	// 重写输出本月工资
	@Override
	public void printMoney() {
		// TODO Auto-generated method stub
		this.salarMoney = super.getSalary(super.getStaMonth());
		System.out.println("姓名:" + super.getStaName() + " 生日月份为：" + super.getStaMonth() + "月" + " 本月工资为：" + salarMoney);
	}

}

///////////////////////// HourlyEmployee 小时工资/////////////////////////////
class HourlyEmployee extends ColaEmployee {
	// 每月工作的小时数
	private int hour;
	private double hourMoney;

	public HourlyEmployee(String staName, int staMonth, int hour) {
		super(staName, staMonth);
		this.hour = hour;
		if (this.hour > 160) {
			// 判断是否本月生日
			this.hourMoney = super.getSalary(super.getStaMonth());
			this.hourMoney = this.hourMoney + (super.getMoney() * 1.5 - super.getMoney());
		} else {
			this.hourMoney = super.getMoney();

		}
	}

	// 重写输出本月工资
	@Override
	public void printMoney() {
		// TODO Auto-generated method stub
		System.out.println(
				"姓名:" + super.getStaName() + " 生日月份为：" + super.getStaMonth() + "月" + " 本月工资为：" + this.hourMoney);
	}

}

/////////////////////// SalesEmployee 销售额/////////////////////////////////////
class SalesEmployee extends ColaEmployee {
	// 每月的销售额
	private int saleRoom;
	// 提取率
	private double royaltyRate;
	// 赚钱的工资
	private double salesMoney;

	// 传参销售额和提成率 销售额 提取率
	public SalesEmployee(String staName, int staMonth, int saleRoom, double royaltyRate) {
		super(staName, staMonth);
		this.saleRoom = saleRoom;
		this.royaltyRate = royaltyRate;
		// 判断是否本月生日
		this.salesMoney = super.getSalary(super.getStaMonth());
		this.salesMoney = this.salesMoney + this.saleRoom * 100 * this.royaltyRate;
	}

	// 重写输出本月工资
	@Override
	public void printMoney() {
		// TODO Auto-generated method stub
		System.out.println(
				"姓名:" + super.getStaName() + " 生日月份为：" + super.getStaMonth() + "月" + " 本月工资为：" + this.salesMoney);
	}

}

class Company {
	public void out() {

	}
}

/////////////// Gardener 园丁//////////////////
class Gardener {

	public Gardener() {
		super();

	}

	public Fruit create(Fruit fruit) {
		if (fruit instanceof Apple) {
			new Apple();
		} else if (fruit instanceof Banana) {
			new Banana();
		} else if (fruit instanceof Grape) {
			new Grape();
		}
		return null;

	}

}

/////////////////////// Apple//////////////////////
class Apple implements Fruit {
	private int app;

	public Apple() {
		super();
		// TODO Auto-generated constructor stub
		System.out.println("创建了一个苹果类的对象");
	}

	public Apple(int app) {
		super();
		this.app = app;
	}

}

////////////////////// Banana///////////////
class Banana implements Fruit {
	private int ban;

	public Banana() {
		super();
		// TODO Auto-generated constructor stub
		System.out.println("创建了一个香蕉类的对象");
	}

	public Banana(int ban) {
		super();
		this.ban = ban;
	}

}

///////////////////// Grape 葡萄/////////////////
class Grape implements Fruit {
	private int gra;

	public Grape() {
		super();
		// TODO Auto-generated constructor stub
		System.out.println("创建了一个葡萄类的对象");
	}

	public Grape(int gra) {
		super();
		this.gra = gra;
	}

}

interface Fruit {

}

/////////////////////////// student03/////////////////////////
class Student03 {
	private String stuName;
	private int stuId;
	private String stuSex;
	private int stuAge;
	private double midTerm;
	private double fiaTerm;
	private double aveScore;

	public Student03() {
		super();
	}

	public Student03(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm) {
		super();
		this.stuName = stuName;
		this.stuId = stuId;
		this.stuSex = stuSex;
		this.stuAge = stuAge;
		this.midTerm = midTerm;
		this.fiaTerm = fiaTerm;
	}

	public String getStuName() {
		return stuName;
	}

	public void setStuName(String stuName) {
		this.stuName = stuName;
	}

	public int getStuId() {
		return stuId;
	}

	public void setStuId(int stuId) {
		this.stuId = stuId;
	}

	public int getStuAge() {
		return stuAge;
	}

	public void setStuAge(int stuAge) {
		this.stuAge = stuAge;
	}

	public String getStuSex() {
		return stuSex;
	}

	public void setStuSex(String stuSex) {
		this.stuSex = stuSex;
	}

	public double getMidTerm() {
		return midTerm;
	}

	public void setMidTerm(double midTerm) {
		this.midTerm = midTerm;
	}

	public double getFiaTerm() {
		return fiaTerm;
	}

	public void setFiaTerm(double fiaTerm) {
		this.fiaTerm = fiaTerm;
	}

	public void printAll() {
		System.out.println("学号为：" + getStuName() + "性别为：" + getStuSex() + "年龄为：" + getStuAge());
	}

}

///////////////////////// English///////////////////////////
class English extends Student03 {
	// 演讲能力
	private double lecture;

	public English() {
		super();
		// TODO Auto-generated constructor stub
	}

	public English(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm,double lecture) {
		super(stuName, stuId, stuSex, stuAge, midTerm, fiaTerm);
		this.lecture=lecture;
		// TODO Auto-generated constructor stub
	}

	public void setLecture(double lecture) {
		this.lecture = lecture;

	}

	public double getLecture() {
		return lecture;
	}

	@Override
	public void printAll() {
		// TODO Auto-generated method stub
		super.printAll();
		System.out.println("综合成绩为：" + this.lecture * 0.5 + super.getMidTerm() * 0.25 + super.getMidTerm() * 0.25);
	}

}

//////////////////////// Computer////////////
class Computer extends Student03 {
	// 操作能力
	private double operate;
	// 英语写作能力
	private double engWrite;

	public Computer() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Computer(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm,double operate,double engWrite) {
		super(stuName, stuId, stuSex, stuAge, midTerm, fiaTerm);
		this.operate=operate;
		this.engWrite=engWrite;
		// TODO Auto-generated constructor stub
	}

	public double getOperate() {
		return operate;
	}

	public void setOperate(double operate) {
		this.operate = operate;
	}

	public double getEngWrite() {
		return engWrite;
	}

	public void setEngWrite(double engWrite) {
		this.engWrite = engWrite;
	}

	@Override
	public void printAll() {
		// TODO Auto-generated method stub
		super.printAll();
		System.out.println("综合成绩为：" + this.operate * 0.4 + this.engWrite * 0.2 + super.getMidTerm() * 0.2
				+ super.getFiaTerm() * 0.2);
	}

}

/////////////////////// literature///////////////////////
class literature extends Student03 {
	// 操作能力
	private double operate;
	// 作品
	private double works;

	public literature() {
		super();
		// TODO Auto-generated constructor stub
	}

	public literature(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm,double operate,double works) {
		super(stuName, stuId, stuSex, stuAge, midTerm, fiaTerm);
		this.operate=operate;
		this.works=works;
		// TODO Auto-generated constructor stub
	}

	public double getOperate() {
		return operate;
	}

	public void setOperate(double operate) {
		this.operate = operate;
	}

	public double getWorks() {
		return works;
	}

	public void setWorks(double works) {
		this.works = works;
	}

	@Override
	public void printAll() {
		// TODO Auto-generated method stub
		super.printAll();
		System.out.println("综合成绩为：" + this.operate * 0.35 + this.works * 0.35 + super.getMidTerm() * 0.15
				+ super.getFiaTerm() * 0.15);

	}

}/*

this.stuName = stuName;
		this.stuId = stuId;
		this.stuSex = stuSex;
		this.stuAge = stuAge;
		this.midTerm = midTerm;
		this.fiaTerm = fiaTerm;
*/

class Manager {
	//声明student对象数组
	private Student03[] stu;
	Scanner sc=new Scanner(System.in);
   public void init() {
	   stu=new Student03[2];
		for(int i=0;i<stu.length;i++) {
			System.out.println("英语系1： 计算机系2：  文学系3：  ");
			int chose=sc.nextInt();
			//临时变量存放数组
			 Student03 stu1=null;
			System.out.println("请输入姓名：");
			String stuName=sc.next();
			System.out.println("请输入学号：");
			int stuId=sc.nextInt();
			System.out.println("请输入性别：");
			String stuSex=sc.next();
			System.out.println("请输入年龄：");
			int stuAge=sc.nextInt();
			System.out.println("输入学生系别 ");
			if(chose==1) {
				//随机演讲能力
				double  lecture=Math.floor(Math.random()*100+1);
				//随机期中分数
				double  midTerm=Math.floor(Math.random()*100+1);
				//随机期末分数
				double  fiaTerm=Math.floor(Math.random()*100+1);
//	public English(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm,double lecture) {

				 stu1=new English(stuName,stuId,stuSex,stuAge,midTerm,fiaTerm,lecture);
			}
			else if(chose==2) {
				/*
				 * 	// 操作能力
	private double operate;
	// 英语写作能力
	private double engWrite;*/
				//英语写作能力
				double  engWrite=Math.floor(Math.random()*100+1);
				//随机操作能力
				double  operate=Math.floor(Math.random()*100+1);
				//随机期中分数
				double  midTerm=Math.floor(Math.random()*100+1);
				//随机期末分数
				double  fiaTerm=Math.floor(Math.random()*100+1);
//	public Computer(String stuName, int stuId, String stuSex, int stuAge, double midTerm, double fiaTerm,double operate,double engWrite) {

				 stu1=new Computer(stuName,stuId,stuSex,stuAge,midTerm,fiaTerm,operate,engWrite);
			}else {
				/*
				 * 	// 操作能力
	private double operate;
	// 作品
	private double works;
*/              //随机操作能力
				double  operate=Math.floor(Math.random()*100+1);
				//随机作品分数
				double  works=Math.floor(Math.random()*100+1);
				//随机期中分数
				double  midTerm=Math.floor(Math.random()*100+1);
				//随机期末分数
				double  fiaTerm=Math.floor(Math.random()*100+1);
				 stu1=new literature(stuName,stuId,stuSex,stuAge,midTerm,fiaTerm,operate,works);

			}
			stu[i]=stu1;
		}
   }
   public void printAllthe() {
	   for (Student03 i : stu) {
		i.printAll();
	}
   }
	

}
